<!-- $Id: brand_search.htm 2009-05-04 liuhui $ -->
<div class="form-div">
  <form action="javascript:search_brand()" name="searchForm">
    <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
{$lang.goods_inquiry_nation} <select name="nation" id="nation" onChange="changeCat(this, 'brand_name')"><option value="">{$lang.goods_inquiry_select}{$lang.goods_inquiry_nation}...</option>{$cat_list}</select>
{$lang.goods_inquiry_brand_name} <select name="brand_name" id="brand_name"><option value="">{$lang.goods_inquiry_select}{$lang.goods_inquiry_brand_name}...</option></select>
{$lang.goods_inquiry_specification} <input type="text" name="specification" size="15" />
{$lang.goods_inquiry_model} <input type="text" name="model" size="15" />
    <input type="submit" value="{$lang.button_search}" class="button" />
  </form>
</div>

<script language="JavaScript">
    function search_brand()
    {
        listTable.filter['nation'] = Utils.trim(document.forms['searchForm'].elements['nation'].value);
        listTable.filter['brand_name'] = Utils.trim(document.forms['searchForm'].elements['brand_name'].value);        
        listTable.filter['specification'] = Utils.trim(document.forms['searchForm'].elements['specification'].value);        
        listTable.filter['model'] = Utils.trim(document.forms['searchForm'].elements['model'].value);        
        
        
	{if $history_query eq 'history_query'}
		listTable.filter['history_query'] = 'history_query';
	{else if $history_query eq 'goods_inquiry_list'}
		listTable.filter['history_query'] = 'goods_inquiry_list';		
	{/if}        
        
        listTable.filter['page'] = 1;
        
        listTable.loadList();
    }

</script>

<script type="text/javascript">
          var arr = new Array();
          var sel_filter_attr = "{$lang.goods_inquiry_select}{$lang.goods_inquiry_brand_name}...";
          {foreach from=$cat_brand_list item=val key=att_cat_id}
            arr[{$att_cat_id}] = new Array();
            {foreach from=$val item=item key=i}
              {foreach from=$item item=attr_val key=attr_id}
                arr[{$att_cat_id}][{$i}] = ["{$attr_val}", {$attr_id}];
              {/foreach}
            {/foreach}
          {/foreach}

          function changeCat(obj, target_id)
          {
            var key = obj.value;
            var sel = document.getElementById(target_id); //window.ActiveXObject ? obj.parentNode.childNodes[4] : obj.parentNode.childNodes[5];
            sel.length = 0;
            sel.options[0] = new Option(sel_filter_attr, 0);
            if (arr[key] == undefined)
            {
              return;
            }
            for (var i= 0; i < arr[key].length ;i++ )
            {
              //sel.options[i+1] = new Option(arr[key][i][0], arr[key][i][1]);
              sel.options[i+1] = new Option(arr[key][i][0], arr[key][i][0]);
            }

          }

          </script>
